<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="/template/template_dialog.xhtml">
	<ui:define name="head">
		<title>#{cTSaReportController.ctModel.stationName} CT饱和分析</title>
		<style>
		   #saTitle {
		       display: inline-block;
		       margin-top:5px;
		   }
		</style>
	</ui:define>
	<ui:define name="content">
		<p:panelGrid columns="1" style="width:100% !important;"
			rendered="#{cTSaReportController.ctModel == null}">
			<f:facet name="header">
				<h:outputText value="CT饱和分析" style="font-size:16px;" />
			</f:facet>
			<h:outputText value="未找到录波文件" style="color:red;" />
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;text-align:center">
			<p:row>
				<p:column style="width:120px;">
					<h:outputLabel value="分析结果:" />
				</p:column>
				<p:column colspan="4">
					<pre align="left"><p:outputLabel value="#{cTSaReportController.check.analyseResult}" rows="5"
						style="width:100%;text-indent: 2em;" /></pre>
				</p:column>
			</p:row>
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;margin-top:10px">  
		    <f:facet name="header">
				<p:row>
				   <p:column colspan="5">
				     <h:outputText value="检查情况" style="font-size:16px;float:left" />
				  </p:column>
				</p:row>
				<p:row>
				   <p:column style="width:12%">
						<h:outputText value="检查人员" />
					</p:column>
				   <p:column style="width:50%">
						<h:outputText value="检查结果" />
					</p:column>
				   <p:column style="width:10%">
						<h:outputText value="检查时间" />
					</p:column>
				   <p:column style="width:8%">
						<h:outputText value="是否确认" />
					</p:column>
					<p:column style="width:25%">
						<h:outputText value="附件" />
					</p:column>
				</p:row>
			</f:facet>
			<p:row rendered="#{cTSaReportController.check!=null}" style="text-align:center">
			   <p:column>
					<h:outputText value="#{cTSaReportController.check.checker}"/>
				</p:column>
			   <p:column>
					<h:outputText value="#{cTSaReportController.check.checkResult}"/>
				</p:column>
			   <p:column>
					<h:outputText value="#{cTSaReportController.check.checkTime}">
					     <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"></f:convertDateTime>
					</h:outputText>
				</p:column>
			   <p:column>
					<h:outputText value="#{cTSaReportController.check.isChecked== true?'是':'否'}"/>
				</p:column>
				<p:column style="text-align:left">
					<p:rowExpansion>
						<p:repeat value="#{cTSaReportController.attachments}" var="file" >
							<div class="row" style="padding-left: 10px;">
								<span>#{file.description}</span>
							</div>
						</p:repeat>
					</p:rowExpansion>
				</p:column>
			</p:row>
			<p:row rendered="#{cTSaReportController.check==null}">
			   <p:column colspan="4">
					<h:outputText value="暂无检查信息" />
				</p:column>
			</p:row>
		</p:panelGrid> 
		<p:panelGrid style="width:100% !important;" columns="6" 
			rendered="#{cTSaReportController.ctModel != null}">
			<f:facet name="header">
				<h:outputText value="故障信息" style="font-size:16px;float:left;margin:5px" />
			</f:facet>
			<h:outputText value="故障时间" />
			<h:outputText value="#{cTSaReportController.ctModel.faultTime}"
				style="color:blue;" />
			<h:outputText value="线路名称" />
			<h:outputText value="#{cTSaReportController.ctModel.lineName}"
				style="color:blue;" />
			<h:outputText value="站名" />
			<h:outputText value="#{cTSaReportController.ctModel.stationName}"
				style="color:blue;" />
			<h:outputText value="相别" />
			<h:outputText value="#{cTSaReportController.ctModel.phase}"
				style="color:blue;" />
			<h:outputText value="故障电流" />
			<h:outputText
				value="#{cTSaReportController.ctModel.faultPointCurrent}"
				style="color:blue;" />
			<h:outputText value="最大电流" />
			<h:outputText value="#{cTSaReportController.ctModel.maxCurrent}"
				style="color:blue;" />
		</p:panelGrid>
		<p:panelGrid style="width:100% !important;" 
			rendered="#{cTSaReportController.ctModel != null}">
			<f:facet name="header">
				<p:row>
					<p:column colspan="7">
					<h:outputText id="saTitle" value="饱和分析" style="float:left;font-size:16px" />
					<p:commandButton value="查看波形" type="button" style="float:right"
							onclick="openCTWave('#{cTSaReportController.ctModel.faultFileId}','#{cTSaReportController.ctModel.stationId}','#{cTSaReportController.ctModel.lineId}','#{cTSaReportController.ctModel.stationName}');">
					</p:commandButton>
					</p:column>
				</p:row>
			</f:facet>
			<p:row>
				<p:column>一次谐波</p:column>
				<p:column>二次谐波</p:column>
				<p:column>三次谐波</p:column>
				<p:column>四次谐波</p:column>
				<p:column>五次谐波</p:column>
				<p:column>六次谐波</p:column>
				<p:column>七次谐波</p:column>
			</p:row>
			<p:row>
				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.firstPowerHarmonic}"
						style="color:blue;" />
				</p:column>
				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.secondPowerHarmonic}"
						style="color:blue;" />
				</p:column>

				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.thirdPowerHarmonic}"
						style="color:blue;" />
				</p:column>
				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.forthPowerHarmonic}"
						style="color:blue;" />
				</p:column>

				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.fifthPowerHarmonic}"
						style="color:blue;" />
				</p:column>
				<p:column>
					<h:outputText
						value="#{cTSaReportController.ctModel.sixthPowerHarmonic}"
						style="color:blue;" />
				</p:column>
				<p:column>
					<h:outputText style="color:blue;"
						value="#{cTSaReportController.ctModel.seventhPowerHarmonic}" />
				</p:column>
			</p:row>
			<p:row style="height:20px">
				<p:column colspan="7">
					<h:outputText value="" />
				</p:column>
			</p:row>
			<p:row>
				<p:column>谐波比</p:column>
				<p:column>
					<h:outputText style="color:#{cTSaReportController.harmonicGe?'red':'blue'};"
						value="#{cTSaReportController.ctModel.seventhPowerHarmonicProportion}" />
				</p:column>
				<p:column>判据</p:column>
				<p:column>
					<h:outputText style="color:blue;" value="#{cTSaReportController.ctHarMinValue}" />
				</p:column>
				<p:column>是否符合</p:column>
				<p:column colspan="2">
					<h:outputText style="color:blue;" value="#{cTSaReportController.harmonicGe?'是':'否'}"/>
				</p:column>
			</p:row>
			<p:row style="height:20px">
				<p:column colspan="7">
					<h:outputText value="" />
				</p:column>
			</p:row>
			<p:row>
				<p:column>面积比</p:column>
				<p:column>
					<h:outputText style="color:#{cTSaReportController.areaGe?'red':'blue'};"
						value="#{cTSaReportController.ctModel.areaProportion}" />
				</p:column>
				<p:column>判据</p:column>
				<p:column>
					<h:outputText style="color:blue;" value="#{cTSaReportController.ctAreaMinValue}" />
				</p:column>
				<p:column>是否符合</p:column>
				<p:column colspan="2">
					<h:outputText style="color:blue;" value="#{cTSaReportController.areaGe?'是':'否'}" />
				</p:column>
			</p:row>
			<p:row style="height:20px">
				<p:column colspan="7">
					<h:outputText value="" />
				</p:column>
			</p:row>
			<p:row>
				<p:column>是否饱和</p:column>
				<p:column colspan="6">
					<h:outputText style="color:blue;"
						value="#{cTSaReportController.ctModel.satiate==true?'是':'否'}" />
				</p:column>
			</p:row>
		</p:panelGrid>
	</ui:define>
	<ui:define name="contentend">
		<script>
			function openCTWave(faultFileId, stationId, lineId, stationName) {
				var url = "/ui/waveh5/index.html?fileId=" + faultFileId
						+ "&amp;stationId=" + stationId + "&amp;lineId="
						+ lineId + "&amp;stationName="
						+ encodeURIComponent(stationName)+"&amp;showBackBtn=true";
				window.location.href=url;
			}
		</script>
	</ui:define>
</ui:composition>